package com.youlu.campus.web.data.controller;


import com.youlu.campus.entity.VO.req.ItemSoldCountReq;
import com.youlu.campus.service.order.OrderItemSoldCountService;
import com.yuelin.infrastructure.quantum.common.QResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class OrderItemSoldCountController {

    @Autowired
    private OrderItemSoldCountService orderItemSoldCountService;

    @GetMapping(value = "/public/item/sold-count/clear")
    public QResult clearItemSoldCountCache(String activityId) {
        orderItemSoldCountService.clearItemSoldCache(activityId);
        return QResult.success(null);
    }

    @PostMapping(value = "/public/item/sold-count/init")
    public QResult initItemSoldCount(@RequestBody ItemSoldCountReq itemSoldCountReq) {
        orderItemSoldCountService.itemSoldCountInit(itemSoldCountReq);
        return QResult.success(null);
    }
}
